package com.hytc.mymall.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;


import com.hytc.mymall.bean.UnionConsumptionBean;
import com.hytc.mymall.viewholder.HomePageHeaderViewHolder;

import java.util.List;

/**
 * Created by allkiss on 2016/12/9
 */
public class HomePageHeaderAdapter extends BaseAdapter
{
    private Context context;
    private List<UnionConsumptionBean> list;

    public HomePageHeaderAdapter(final Context context, final List<UnionConsumptionBean> list) {
        this.context = context;
        this.list = list;
    }

    public int getCount() {
        return 1 + this.list.size();
    }

    public Object getItem(final int n) {
        return null;
    }

    public long getItemId(final int n) {
        return 0L;
    }

    public View getView(final int n, final View view, final ViewGroup viewGroup) {
        View inflate;
        HomePageHeaderViewHolder tag;
        if (view == null) {
            inflate = View.inflate(this.context, 2130903146, (ViewGroup)null);
            tag = new HomePageHeaderViewHolder();
            tag.consumptionseries = (TextView)inflate.findViewById(2131100160);
            tag.totalconsumption = (TextView)inflate.findViewById(2131100161);
            tag.lovenumber = (TextView)inflate.findViewById(2131100162);
            inflate.setTag((Object)tag);
        }
        else {
            inflate = view;
            tag = (HomePageHeaderViewHolder)view.getTag();
        }
        String text;
        String text2;
        String text3;
        if (n == 0) {
            text = this.context.getResources().getString(2131361863);
            text2 = this.context.getResources().getString(2131361870);
            text3 = this.context.getResources().getString(2131361848);
        }
        else {
            final UnionConsumptionBean unionConsumptionBean = this.list.get(n - 1);
            text = unionConsumptionBean.consumptionSeries;
            text2 = unionConsumptionBean.totalAmount;
            text3 = unionConsumptionBean.loveNumber;
        }
        tag.consumptionseries.setText((CharSequence)text);
        tag.totalconsumption.setText((CharSequence)text2);
        tag.lovenumber.setText((CharSequence)text3);
        return inflate;
    }
}
